<template>
  <div class="teach">
    <div class="header">
      <p @click="back">
        <Icon name="arrow-left" />
      </p>
      <p>讲师详情</p>
      <p></p>
    </div>
    <div class="head_con">
      <div class="c">
        <img class="img" :src="tea.avatar" alt />
        <div class="teach_main">
          <p class="name">
            <span style="color:#000">{{tea.teacher_name}}</span>
            <font color="orange">{{tea.level_name}}</font>
          </p>
          <p class="sex">
            <span>{{tea.sex|sex}}</span>
            <span>{{tea.teach_age}}年教龄</span>
          </p>
        </div>
        <p>
          <button class="btn" @click="getDetail(tea)">查看详情</button>
        </p>
      </div>
    </div>

    <div class="aa">选择时间（北京时间）</div>
  </div>
</template>

<script>
import { Icon } from "vant";
import { getTeach } from "../../https/https";
export default {
  filters: {
    sex(val) {
      if (val == 1) {
        return "女";
      } else {
        return "男";
      }
    },
  },
  components: {
    Icon,
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
    getDetail(item) {
      console.log(item.teacher_id);
      this.$router.push({
        path: "/teachdetail",
        query: {
          id: item.id,
        },
      });
    },
  },
  data() {
    return {
      id: 0,
      tea: {},
    };
  },
  mounted() {
    this.id = this.$route.query.id;
    getTeach(this.id).then((res) => {
      console.log(res);
      this.tea = res.teacher;
    });
  },
};
</script>

<style scoped>
.teach {
  background-color: #eee;
  padding-bottom: 150px;
}
.header {
  width: 100%;
  height: 100px;
  background: linear-gradient(180deg, #63b7fe, #4e7de3);
  display: flex;
  justify-content: space-between;
}
.header > p {
  padding-top: 10px;
  color: #ffffff;
  font-size: 18px;
}
.head_con {
  width: 90%;
  height: 70px;
  border-radius: 10px;
  background-color: #ffffff;
  margin: 0 auto;
  margin-top: -50px;
  padding: 15px 0 0 15px;
}
.img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}
.c {
  display: flex;
}
.teach_main > p {
  margin-left: 10px;
  margin-top: 5px;
  color: #999;
}
.btn {
  border-radius: 20px;
  background-color: #eee;
  border: 1px solid orange;
  color: red;
  margin-left: 100px;
  margin-top: 10px;
  padding: 5px 10px;
}
.sex > span {
  margin-right: 10px;
}
.aa{
    margin-top: 10px;
    margin-left: 2.5%;
    color: #666;
    padding-left: 10px;
    border-left: 2px solid orange;
}
</style>